using UnityEngine;

namespace Super
{
	public class ComponentProperty<T>
	{
		public Transform parent;
		public string path;

		public T value;
		public T Value
		{
			get
			{
				if (value == null)
				{
					value = parent.Find(path).GetComponent<T>();
				}
				return value;
			}
		}

		public ComponentProperty(string path)
		{
			this.path = path;
		}

		public ComponentProperty(Transform parent, string path)
		{
			this.parent = parent;
			this.path = path;
		}

		public void SetParent(Transform parent)
		{
			this.parent = parent;
		}
	}
}
